package com.sirdc.modules.paas.api.mo;

import java.util.HashMap;
import java.util.Map;

import com.sirdc.modules.paas.api.common.CommonRequest;
import com.sirdc.modules.paas.api.common.util.HttpClientUtil;


/**
 * 接收短信请求类.
 * 
 * @author Qing
 * @e-mail lhq@suncco.com
 * @version v1.0
 * @copyright 2010-2015
 * @create-time 2013-9-18 下午5:36:41
 * 
 */
public class MoRequest extends CommonRequest {

	private static final long serialVersionUID = -593498186722620004L;

	/**
	 * 初始化接收短信请求类.
	 * @param appCode 应用编号.
	 * @param appKey 应用KEY.
	 * @param url 接收短信请求的URL.
	 */
	public MoRequest(String appCode, String appKey, String url) {
		super(appCode, appKey, url);
	}

	/**
	 * 接收指定条数的短信.
	 * @param amount 接收短信的条数.
	 * @return
	 */
	public MoResponse receive(String amount) {
		Map<String, Object> parameters = new HashMap<String, Object>();
		// 设置应用公共属性.
		parameters.put("appCode", appCode);
		parameters.put("appKey", appKey);
		// 设置业务属性.
		parameters.put("amount", amount);
		// 发起https请求.
		String responseStr = HttpClientUtil.httpPost(getUrl(), parameters);
		MoResponse response = new MoResponse(responseStr);
		return response;
	}

}
